import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'MainLayout',
    component: () => import("../views/Layout/MainLayout.vue"),
    redirect: "/home",
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/Home/HomeView.vue')
      },
      {
        path: '/ai/chat',
        name: 'chat',
        component: () => import('../views/AIChat/AIChatView.vue')
      },
      {
        path: '/ai/charts',
        name: 'charts',
        component: () => import('../views/AICharts/AIChartsView.vue')
      },
      {
        path: '/personal/:personalId/:personalName',
        name: 'personal',
        component: () => import('../views/Personal/PersonalView.vue')
      },
      {
        path: '/personal/setting',
        name: 'setting',
        component: () => import('../views/Personal/PersonalSetting.vue')
      },
      {
        path: '/publication/:postId/:postData',
        name: 'publication',
        component: () => import('../views/Publication/PublicationView.vue')
      },
      {
        path: '/publication/success',
        name: 'publicationSuccess',
        component: () => import('../views/Publication/PublicationSuccess.vue')
      },
      {
        path: '/post/:postId/:postTitle',
        name: 'LookPost',
        component: () => import('../views/Post/LookPostView.vue')
      },
    ],
  },
  {
    path: "*",
    name: "NotFound",
    component: () => import('../views/NotFoundView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
